//
//  HLEToastContentView.m
//  HLETips
//
//  Created by hle1 on 2020/5/22.
//

#import "HLEToastContentView.h"
#import <Masonry/Masonry.h>
#define UIColorMakeWithRGBA(r, g, b, a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a/1.0]

@implementation HLEToastContentView


- (instancetype)init
{
    self = [super init];
    if (self) {
        self.backgroundColor = UIColorMakeWithRGBA(51, 51, 51, 0.8);
        self.layer.cornerRadius = 10.0f;
        self.layer.masksToBounds = YES;
//        [self initSubviews];
    }
    return self;
}

- (void)initSubviews {

    [self.customView mas_makeConstraints:^(MASConstraintMaker *make) {
       make.top.mas_equalTo(22);
       make.centerX.mas_equalTo(0);
    }];
    
    _textLabel = [[UILabel alloc] init];
    self.textLabel.numberOfLines = 0;
    self.textLabel.opaque = NO;
    self.textLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:self.textLabel];
        
    [self.textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_customView.mas_bottom).offset(8);
        make.bottom.mas_equalTo(-16);
        make.left.mas_equalTo(29);
        make.right.mas_equalTo(-29);
    }];
}

- (void)setCustomView:(UIView *)customView {
    if (self.customView) {
        [self.customView removeFromSuperview];
        _customView = nil;
    }
    _customView = customView;
    [self addSubview:self.customView];
    
   
}
@end
